<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title><spring:message code="message.lable.LiShiDingDanDetailChaKan"/></title>
<%@ include file="/WEB-INF/component/commonCSS.jsp"%>
<!--[if lt IE 9]>
        <script src="lib/js/html5shiv.min.js"></script>
        <script src="lib/js/respond.min.js"></script>
    <![endif]-->
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
	<input type="hidden" id="typeflag" value='null'>
	<section class="content-header">
	<h1><spring:message code="message.lable.LiShiDingDanDetailChaKan"/></h1>
	<ol class="breadcrumb">
			<li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i><spring:message code="message.lable.first"/></a></li>
            <li><a href="#"><spring:message code="message.list.DingDanGuanLi"/></a></li>
            <li><a href="#"><spring:message code="message.lable.WoDeDingDan"/></a></li>
			<li class="active"><a href="#"><spring:message code="message.lable.LiShiDingDanDetailChaKan"/></a></li>
	</ol>
	</section>

	<section class="content">
	<div class=" box box-success">
		<div class="box-body">
			<div class="input">
				<div class="textalign1"><spring:message code="message.listForm.tongYongMing"/><spring:message code="message.yanZheng.maoHao"/></div>
	                    <div class="boxinput">
	                    <input type="text" class="textinput" id="drugName"	name="drugName" placeholder="<spring:message code="message.listForm.tongYongMing"/>" />
	                    </div>
                	<div class="textalign"><spring:message code="message.listForm.yaoPinBianMa"/><spring:message code="message.yanZheng.maoHao"/></div>
	                    <div class="boxinput">
	                    <input type="text" class="textinput" id="drugCode"	name="drugCode" placeholder="<spring:message code="message.listForm.yaoPinBianMa"/>" />
	                    </div>
				<div class="textalign"><spring:message code="message.listForm.shengChanQiYe"/><spring:message code="message.yanZheng.maoHao"/></div>
	                    <div class="boxinput">
	                    <input type="text" class="textinput" id="prodComp"	name="prodComp" placeholder="<spring:message code="message.listForm.shengChanQiYe"/>" />
	                    </div>
                </div>
                <div class="input" style="margin-top:-5px">
	            	<div class="textalign1"><spring:message code="message.listForm.DingDanMingXiBianHao"/><spring:message code="message.yanZheng.maoHao"/></div>
					<div class="boxinput">
					<input type="text" class="textinput" id="orderCode" name="orderCode" placeholder="<spring:message code="message.listForm.DingDanMingXiBianHao"/>" />
					</div>
				<div class="textalign"><spring:message code="message.listForm.DingDanZhuangTai"/><spring:message code="message.yanZheng.maoHao"/></div>
                       <div class="boxinput">
                       <select class="textinput"  name="orderStatus" id = "orderStatus">
                       </select>
                 	   </div>
				 <div class="textalign"><spring:message code="message.listForm.CaiGouRiQi"/><spring:message code="message.yanZheng.maoHao"/></div>
	                <div class="boxinput"> 
                       <table style="width:100%">
                                <tr>
                                    <td style="width:50%">
                                        <input id="joinPlanTimeStr" name="joinPlanTimeStr" type="text" class="textinput"   placeholder="yyyy-MM-dd" 
                            data-date-fmt="yyyy-MM-dd" onFocus="WdatePicker({maxDate:'#F{$dp.$D(\'joinPlanTimeEnd\')}'})" />
                                    </td>
                                    <td>&nbsp;-&nbsp;</td>
                                    <td style="width:50%">
                                        <input id="joinPlanTimeEnd" name="joinPlanTimeEnd" type="text" class="textinput" placeholder="yyyy-MM-dd" 
                            data-date-fmt="yyyy-MM-dd" onFocus="WdatePicker({minDate:'#F{$dp.$D(\'joinPlanTimeStr\')}'})" />
                                    </td>
                                </tr>
                            </table>
                    </div>
	             </div>
	             <div class="input" style="margin-top:-5px">
				 <div class="textalign1"><spring:message code="message.listForm.QueRenRiQi"/><spring:message code="message.yanZheng.maoHao"/></div>
	                <div class="boxinput"> 
                       <table style="width:100%">
                                <tr>
                                    <td style="width:50%">
                                        <input id="submitStartDatetime" name="submitStartDatetime" type="text" class="textinput"   placeholder="yyyy-MM-dd" 
                            data-date-fmt="yyyy-MM-dd" onFocus="WdatePicker({maxDate:'#F{$dp.$D(\'submitEndDatetime\')}'})" />
                                    </td>
                                    <td>&nbsp;-&nbsp;</td>
                                    <td style="width:50%">
                                        <input id="submitEndDatetime" name="submitEndDatetime" type="text" class="textinput" placeholder="yyyy-MM-dd" 
                            data-date-fmt="yyyy-MM-dd" onFocus="WdatePicker({minDate:'#F{$dp.$D(\'submitStartDatetime\')}'})" />
                                    </td>
                                </tr>
                            </table>
                    </div>
                    <div class="textalign"><spring:message code="message.listForm.PeiSongRiQi"/><spring:message code="message.yanZheng.maoHao"/></div>
	                <div class="boxinput"> 
                       <table style="width:100%">
                                <tr>
                                    <td style="width:50%">
                                        <input id="delDatetimeStr" name="delDatetimeStr" type="text" class="textinput"   placeholder="yyyy-MM-dd" 
                            data-date-fmt="yyyy-MM-dd" onFocus="WdatePicker({maxDate:'#F{$dp.$D(\'delDatetimeEnd\')}'})" />
                                    </td>
                                    <td>&nbsp;-&nbsp;</td>
                                    <td style="width:50%">
                                        <input id="delDatetimeEnd" name="delDatetimeEnd" type="text" class="textinput" placeholder="yyyy-MM-dd" 
                            data-date-fmt="yyyy-MM-dd" onFocus="WdatePicker({minDate:'#F{$dp.$D(\'delDatetimeStr\')}'})" />
                                    </td>
                                </tr>
                            </table>
                    </div>
                    <div class="textalign"><spring:message code="message.listForm.PeiSongQiYe"/><spring:message code="message.yanZheng.maoHao"/></div>
	                    <div class="boxinput">
	                    <input type="text" class="textinput" id="delName"	name="delName" placeholder="<spring:message code="message.listForm.PeiSongQiYe"/>" />
	                    </div>
	             </div>
	             <div class="input" style="margin-top:3px">
	             	<div class="textalign1"><spring:message code="message.listForm.GuiDangYuanYin"/><spring:message code="message.yanZheng.maoHao"/></div>
	                    <div class="boxinput">
	                    <input type="text" class="textinput" id="archiveType"	name="archiveType" placeholder="<spring:message code="message.listForm.GuiDangYuanYin"/>" />
	                    </div>
	             <div class="textalign" >
				<button type="button" class="btn btn-success btn-sm" id="selectDicCompType"><spring:message code="message.button.seachSpacing"/></button>
				</div>
				</div>
		</div>
	</div>
	<table class="jqgrid" id="gridlist"></table>
	<div id="gridpage"></div>
	</section>
	<%@ include file="/WEB-INF/component/commonJS.jsp"%>
	<script type="text/javascript">
	//绑定回车
    $('#drugName,#drugCode,#prodComp,#orderCode,#orderStatus,#joinPlanTimeStr,#joinPlanTimeEnd,#submitStartDatetime,#submitEndDatetime,#delDatetimeStr,#delDatetimeEnd,#delName,#archiveType').bind('keydown', function(event) { 
        if (event.keyCode == "13") {
            $('#selectDicCompType').click();
        }
    });	
    $("#drugName").focus();//加载页面光标在第一个查询框内
	
	
	
		$(function() {
			$("#gridlist").jqGrid(
					{   url : "getOrdersDetailListOldByHosp.html",
						mtype : "POST",
						datatype : "json",
						autowidth : true,
						shrinkToFit : false,
						height : 260,
						colNames : [
						            '<spring:message code="message.listForm.DingDanMingXiBianHao"/>',
						            '<spring:message code="message.listForm.CaiGouShiJian"/>',
						            '<spring:message code="message.listForm.CaiGouJia"/>',
						            '<spring:message code="message.listForm.CaiGouShuLiang"/>',
						            '<spring:message code="message.listForm.CaiGouJinE"/>',
						            '<spring:message code="message.listForm.PeiSongQiYe"/>',
						            '<spring:message code="message.listForm.QueRenShiJian"/>',
						            '<spring:message code="message.listForm.PeiSongShiJian"/>',
						            '<spring:message code="message.listForm.PeiSongShuLiang"/>',
						            '<spring:message code="message.listForm.PeiSongJinE"/>',
						            '<spring:message code="message.listForm.DaoHuoShiJian"/>',
						            '<spring:message code="message.listForm.DaoHuoShuLiang"/>',
						            '<spring:message code="message.listForm.DaoHuoJinE"/>',
						            '<spring:message code="message.listForm.yaoPinBianMa"/>',
			                        '<spring:message code="message.listForm.tongYongMing"/>', 
			                        '<spring:message code="message.listForm.jiXing"/>',
			                        '<spring:message code="message.listForm.guiGe"/>',
			                        '<spring:message code="message.listForm.zhuanHuanXiShu"/>',
			                        '<spring:message code="message.listForm.baoZhuangDanWei"/>', 
			                        '<spring:message code="message.listForm.caiZhi"/>',
			                        '<spring:message code="message.listForm.shengChanQiYe"/>',
			                        '<spring:message code="message.listForm.CaiGouXianJia"/>',
						            '<spring:message code="message.listForm.IsorNoBeiAn"/>',
						            '<spring:message code="message.listForm.BeiAnLeiXing"/>',
						            '<spring:message code="message.listForm.GuiDangLeiXing"/>',
						            '<spring:message code="message.listForm.DingDanBaoHao"/>',
						            '<spring:message code="message.listForm.DingDanZhuangTai"/>'
						            ],
						colModel : [{name : 'orderCode',index : 'sdate',width : 210, sortable: false, align : "center"/* ,
										formatter:function(cellvalue, options, row){
										 	return "<a href=\"javascript:$.HN.dialog.opendialog('"+row.orderId+"','"+cellvalue+"','${ctx}/purOrderInfo/toOrderLogisticsByIdOld.html?orderId="+row.orderId+"','800px','400px',function operResult(val){return operResult;})\">"+cellvalue+"</a>";
			                    		}	 */
						
									},
									{name : 'joinPlanTime',index : 'sdate',width : 140, sortable: false, align : "center"}, 
									{name : 'proPrice',index : 'ship',width : 80, sortable: false, align : "right",
										formatter:function(cellvalue, options, row) {
											   return formatAmount(cellvalue, options, row) ;
									  	}
									},
									{name : 'proCount',index : 'ship',width : 80, sortable: false, align : "center"},
									{name : 'totalPrice',index : 'ship',width : 80, sortable: false, align : "right",
										formatter:function(cellvalue, options, row) {
											   return formatAmount(cellvalue, options, row) ;
									  	}	
									},
									{name : 'compName',index : 'compName',width : 190, sortable: false, align : "left"/* ,
										 formatter:function(cellvalue, options,row) {
											 return "<a href=\"javascript:$.HN.dialog.opendialog('"+row.compId+"','"+cellvalue+"','${ctx}/stdCompinfo/toStdCompinfoDetail.html?compId="+row.compId+"','800px','400px',function operResult(val){return operResult;})\">"+cellvalue+"</a>";
							     		} */
									},
									{name : 'submitDatetime',index : 'name',width : 140, sortable: false, align : "center"},
									{name : 'delDatetime',index : 'name',width : 140, sortable: false, align : "center"},
									{name : 'delCount',index : 'name',width : 80, sortable: false, align : "center"},
									{name : 'delTotalPrice',index : 'stock',width : 80, sortable: false, align : "right",
										formatter:function(cellvalue, options, row) {
											   return formatAmount(cellvalue, options, row) ;
									  	}	
									},
									{name : 'recpDatetime',index : 'stock',width : 140, sortable: false, align : "center"},
									{name : 'recpCount',index : 'stock',width : 80, sortable: false, align : "center"},
									{name : 'recpTotalPrice',index : 'stock',width : 80, sortable: false, align : "right",
										formatter:function(cellvalue, options, row) {
											   return formatAmount(cellvalue, options, row) ;
									  	}	
									},
									
									{name : 'drugCode',index : 'drugCode',width : 100, sortable: false, align : "center"/* ,
										   formatter:function(cellvalue, options, row) {
											   return "<a href=\"javascript:$.HN.dialog.opendialog('"+row.drugId+"','"+cellvalue+"','${ctx}/stdDrug/drugInfoDetail.html?drugId="+row.drugId+"','800px','400px',function operResult(val){return operResult;})\">"+cellvalue+"</a>";
									  	} */
									}, 
									{name : 'drugName',index : 'ship',width : 140, sortable: false, align : "left"},
									{name : 'formName',index : 'ship',width : 80, sortable: false, align : "center"},
									{name : 'specName',index : 'ship',width : 80, sortable: false, align : "center"},
									{name : 'factor',index : 'ship',width : 80, sortable: false, align : "center"},
									{name : 'unit',index : 'ship',width : 40, sortable: false, align : "center"}, 
									{name : 'materialName',index : 'ship',width : 80, sortable: false, align : "center"}, 
									{name : 'prodComp',index : 'prodComp',width : 180, sortable: false, align : "left"/* ,
										 formatter:function(cellvalue, options,row) {
											 return "<a href=\"javascript:$.HN.dialog.opendialog('"+row.prodCompId+"','"+cellvalue+"','${ctx}/stdCompinfo/toStdCompinfoDetail.html?compId="+row.prodCompId+"','800px','400px',function operResult(val){return operResult;})\">"+cellvalue+"</a>";
							     		} */
									},
									{name : 'proPriceLimit',index : 'proPriceLimit',width : 80, sortable: false, align : "right"},
									{name : 'bakDrugFlag',index : 'ship',width : 80, sortable: false, align : "center",
										formatter:function(cellvalue, options, row){
				                            return cellvalue == 1 ? "<spring:message code="message.listForm.shi"/>" : "<spring:message code="message.listForm.fou"/>";
				                        }
									},
									{name : 'isLongtimePlan',index : 'ship',width : 80, sortable: false, align : "center",
										formatter:function(cellvalue,row){
											if (row.bakDrugFlag == 1) {
												return cellvalue == 1 ? "<spring:message code="message.listForm.ChangQiBeiAnLeiXing"/>" : "<spring:message code="message.listForm.LinShiBeiAn"/>"; 
											}else{
												return cellvalue = "—";
											}
										}
									},
									{name : 'dicName',index : 'dicName',hidden:true,width : 130, sortable: false, align : "left"},
									{name : 'orderPackId',index : 'orderPackId',width : 200, sortable: false, align : "center"/* ,
										formatter:function(cellvalue, options, row){
										 	return "<a href=\"javascript:$.HN.dialog.opendialog('"+row.orderPackId+"','"+cellvalue+"','${ctx}/purOrderInfo/toOrderLogisticsOld.html?orderPackId="+row.orderPackId+"&delCompName="+row.compName+"','800px','400px',function operResult(val){return operResult;})\">"+cellvalue+"</a>";
			                    		} */
									},
									{name : 'orderStatus',index : 'orderStatus',width :80, sortable: false, align : "center"}
						],
						rowNum : 20,
						rowList : [ 10, 20,50,100],
						rownumbers : true,
						pager : "#gridpage",
						//multiselect: true, 
						viewrecords : true,
						gridComplete: function(){
				        	 //序号列宽度自适应（参数为jqgridID）
				               autoRNWidth("gridlist");
				           	//数据只有一条时默认选中（参数为jqgridID）
				               selectByOneData("gridlist");
						},
						caption : "<spring:message code="message.list.LiShiCaiGouDingDanLieBiao"/>",
						jsonReader : {
							repeatitems : false,
							id : "ids"
						}
					});
			//订单状态
		    $("#orderStatus").HNSelect({
     	        url: "${pageContext.request.contextPath}/selectController/getOrderStatus.html",
     	        data: { classifyCode: '119' },
     	        defaultText: "<option value=''><spring:message code="message.select.option"/></option>",
     	    });
		    //归档原因
		    $("#archiveType").HNSelect({
     	        url: "${pageContext.request.contextPath}/selectController/getOrderStatus.html",
     	        data: { classifyCode: '118' },//
     	        defaultText: "<option value=''><spring:message code="message.select.option"/></option>",
     	    });
			$("#gridlist").jqGrid('navGrid', '#gridpage', {add : false,edit : false,del : false,search : false,refresh : false});
			$(window).trigger("resize");
			$("#gridlist").jqGrid('setGridHeight', create());
			   /*按条件查询*/
			   $('.btn-success').click(function(){
					   var postJson = formatForm("form");
					   var strat = new Date( postJson['submitStartDatetime'].replace(/-/g,"/") );
					   var End = new Date( postJson['submitEndDatetime'].replace(/-/g,"/") );
					   if (strat > End) {
						 var temp =postJson['submitStartDatetime'];
						 postJson['submitStartDatetime'] = postJson['submitEndDatetime'];
						 postJson['submitEndDatetime']= temp;
						 $("[name='submitStartDatetime']").val($("[name='submitEndDatetime']").val());
						 $("[name='submitEndDatetime']").val(temp);
						 temp=null;
					   }
			                $("#gridlist").jqGrid("clearGridData");
			                $("#gridlist").jqGrid('setGridParam',{  
			                mtype: "POST",
			                datatype:'json',
			                postData:postJson,
			                page : 1
			            }).trigger("reloadGrid"); 
			   });
		});
	</script>
</body>
</html>